﻿using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;
using UnityEngine.UI;
using VFramework;

namespace VFramework
{


    public class VUILoadSceneBar : MonoBehaviour
    {

        AsyncOperation asyncc = null;

        public Slider progressBar;

        public Text progressText;

        // Use this for initialization
        void Start()
        {
            progressBar.value = 0;
			asyncc = SceneManager.LoadSceneAsync(VConfig.next_scene == null ? "game": VConfig.next_scene);
            VConfig.next_scene = null;
        }

        void Update()
        {
            if (asyncc != null)
            {
                progressText.text = (asyncc.progress * 100).ToString("0.00") + "%";
                progressBar.value = asyncc.progress;
            }
        }

    }

}